# !/usr/bin/env python
# _*_ coding:utf-8 _*_


# 序列化 也可以 过期时间
from django.conf import settings
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings.dev")

class  SecretOauth(object):
    def __init__(self):
        self.serializer = Serializer(secret_key=settings.SECRET_KEY, expires_in=24 * 15 * 60)

    # 加密
    def dumps(self,data):

        result = self.serializer.dumps(data)

        return result.decode()


    # 解密
    def loads(self,data):

        result = self.serializer.loads(data)

        return result


